<template>
  <div>这是child2组件 - {{ counter.count }}</div>
  <button>-</button>
  <span>{{ counter2.num }}</span>
  <button @click="add">+</button>
  <div>doubleNum: {{ counter2.doubleNum }}</div>
</template>

<script setup lang="ts">
import { useCounterStore } from "@/stores/counter";
import { useCounterStore2 } from "@/stores/counter2";

const counter = useCounterStore();
const counter2 = useCounterStore2();

const add = () => {
  // couter2.num++;
  // counter2.$patch({
  //   num: counter2.num + 1,
  // });
  counter2.increment();
};
</script>
